package com.jtpay.ysfproductionprocess.utils;

import android.text.TextUtils;

import static com.jtpay.ysfproductionprocess.utils.PayContext.Debug;

/**
 * Description:
 * Date : 2018/06/14 10:17
 * Author : Joe
 */

public class ApiConstant {
    //    public static final String DEBUG_URL = "https://www.036buy.com/";//
    private static final String DEBUG_SERVER_ADDRESS_DEF = "http://test2wgzlw.jtpay.com/";
    private static final String RELEASE_SERVER_ADDRESS_DEF = "http://zhizhuan.jtpay.com/";
    public static final String DEBUG_SERVER_UPLOAD_LOG_ADDRESS_DEF = "http://47.94.45.2:9002";
    private static final String DEBUG_IP_DEF = "47.94.45.2";
    private static final String SEPARATOR = "/";
    public static String URL_IP = "";
    // 6 minute
    public static final long DEFAULT_TIMEOUT = 150L;
    public static final int DEFAULT_FILE_UPLOAD_TIMEOUT = 3600;
    public static final int DEFAULT_TIMEOUT_DEF = 5;

    public static final int HTTP_SUCCESS = 1;
    /*
    *-1是错误  1是正确   -1004是虚拟卡失效  -10000是云闪付服务器返回错误
    */
    public static final int HTTP_FAILURE = -1;
    public static final int HTTP_VIRTUAL_CARD_FAILURE = -1004;

    public final static String GET_TASK_API = "LongConnection/GetTask";
    public final static String GET_ENCRYPT_QR_INFO = "api/GetEncryptQrInfo";
    public final static String STORAGE_QR_INFO = "api/StorageQrInfo";
    public final static String SET_ORDER_ID = "api/SetOrderId";
    public final static String SET_DECRYPT_CONTENT = "api/SetDecryptContent";
    public final static String GET_SERVER_ADDRESS_API = "api/GetHandlerExeMessage";
    public final static String UPLOAD_LOG_API = "api/uploadLog";
    public final static String UPLOAD_LOG_FILE_API = "api/uploadlogfiles";

    public static String getUrl() {
        if (TextUtils.isEmpty(URL_IP)) {
            URL_IP = DEBUG_IP_DEF;
        }
        return "http://" + URL_IP + SEPARATOR;
    }

    public static String getGetServerAddressApi() {
        return Debug ? DEBUG_SERVER_ADDRESS_DEF : RELEASE_SERVER_ADDRESS_DEF;
    }
}
